package io;

import java.io.*;

/**
 * @program: javase
 * @description:
 * @author: luolidong
 * @create: 2021-06-28 11:26
 * @version: 1.0
 */
public class InputStreamTest {
    public static void main(String[] args) throws IOException {
        System.err.println("error");
        //字符输入流
//        InputStreamReader streamReader = new InputStreamReader(System.in);
//        BufferedReader reader = new BufferedReader(streamReader);
//        System.out.println(streamReader.read());
//        System.out.println(streamReader.getEncoding());
//        System.out.println(reader.read());
        FileOutputStream fileOutputStream = new FileOutputStream(".//old.txt");
//        fileOutputStream.write(bytes);
        InputStream in = System.in;
//        FileWriter fileWriter = new FileWriter(".//old.txt");
        int len=0;
        byte[] bytes = new byte[1024];
        while ((len=in.read(bytes))!=-1){
            fileOutputStream.write(bytes, 0, len);
        }
        fileOutputStream.close();
        in.close();
    }
}
